package com.lcj.eduService.controller;

import com.lcj.commonutils.R;
import com.lcj.eduService.service.OssService;
import net.bytebuddy.asm.Advice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author：LCJ
 * @Description：
 * @Date：Create in 22:17 2021/2/25 0025
 */
@RestController
@RequestMapping("/eduoss/file")
@CrossOrigin
public class OssController {

    @Autowired
    private OssService ossService;


    //上传头像
    @PostMapping
    public R uploadOssFile(MultipartFile file){
        //获取上传文件
        String url=ossService.updateAvatar(file);
        return R.ok().data("url",url);
    }
}
